import org.apache.spark.api.java.function.MapFunction;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Encoders;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;

import java.util.Properties;

/***
 * @author hunter.d
 * @qq 657270652
 * @wx haitao-duan
 * @date 2020/9/10
 **/
public class JavaWorldCount {

    public static void main(String[] args) {

        SparkSession session = SparkSession.builder().appName("WordCount").master("local[*]").getOrCreate();
        Properties properties=new Properties();
        properties.setProperty("user","root");
        properties.setProperty("password","123456");
        Dataset<Row> data = session.read().jdbc("localhost:3306", "table", properties);
        Dataset<String> dataset = data.map(new MapFunction<Row, String>() {
            public String call(Row value) throws Exception {

                return "";
            }
        }, Encoders.STRING());


    }

}
